<?php

class imageControl extends Control{
	function add_cate(){//添加图片栏目

		$this->display();
	}
	function imagecate_show(){//显示所有的图片栏
		$db=M("category");
		$category=$db->all();
		$this->assign("category",$category);	
		$this->display();
	}
	function img_show(){
		$db=K("imgsrelation");
		$row=$db->field("id,description,gourl,imid,thumb")->order("id")->all();
		$this->assign("row",$row);
		$this->display();
	}
	function imgupdate(){
		 $db=M("upload");
		 $id=$_POST['imid'];
		$row=$db->where("imid=$id")->find();
		$_POST['addtime']=date("y-m-d h:i:s",time());//修改后时间也发生变化
		$db->where("imid='$id'")->save();
		if($db->get_affected_rows()){
			echo 1;
		}else{
			echo 2;
		}



	}


	




}



?>
